#!/usr/bin/perl -w
use DBI;
use mydb;
use myvideo;
use Config::IniFiles;

	my $cfg = new Config::IniFiles( -file=>"server.ini",
                                 -allowcontinue=>0,
                                 -reloadwarn=>1,
                                -nocase=>1,);


	my $servername = $cfg->val('register','servername');
	my $type = $cfg->val('register','type');
	my $ip = $cfg->val('register','ip');
	my $user = $cfg->val('register','user');
	my $passwd = $cfg->val('register','passwd');
	my $path = $cfg->val('register','path');

	if(
	   $servername eq'undef' || $servername eq ''||
	   $type eq'undef' || $type eq ''||
	   $ip eq'undef' || $ip eq ''||
	   $user eq'undef' || $user eq ''||
	   $passwd eq'undef' || $passwd eq ''||
	   $path eq'undef' || $path eq ''

	) {

	   die("取配置文件错误！");
	}

	my_connect();

	$sql = "SELECT * FROM c_server WHERE status = 'normal' and server = \'$servername\'";
	$sth = $dbconn->prepare($sql) or die $dbconn->errstr;
	$sth->execute() or die "错误: " . $sth->errstr;

	while(my @dat=$sth->fetchrow_array()) {
	
		print "server($servername) ip:$dat[4]  type:$dat[5] path:$dat[6]  status:$dat[10] maxnum:$dat[8]  running:$dat[9]\n"; 
	}
